All Questions
18 questions
1vote
2answers
205views
Why do we separate interface when implementing interface injection variant of DI?
With interface injection (wikpedia) we have a method to set the dependency on the client as part of an interfase. public interface ServiceSetter { public void setService(Service service); } Why ...
0votes
1answer
379views
Inject configuration files into the injector is it an antipattern?
I'm trying to design a system that inject configuration of each component into each class. project structure: |features --|component-a component-a.service.js component-a.config....
0votes
6answers
1kviews
If it is a bad practice to use an interface if only one class will implement it, what is the purpose of IoC container?
Okay, first of all I understand the concept of IoC container! It's used to implement automatic dependency injection so you won't have to manually inject dependencies to class. It can automatically ...
4votes
1answer
961views
Dependency Injection: What are advantages of using a framework? [duplicate]
Introduction and Question I understand what the advantages of dependency injection, e.g. constructor injection or setter injection and that it is one way of doing inversion of control. I also ...
1vote
1answer
671views
How to define Composition Roots for libraries (Javascript/inversify)
I'm building a console app (A), which depends on library B. Library B further depends on library C. I am building all 3 entities. Most of the development completed so far has been done using a ...
0votes
0answers
166views
Is using IoC with data classes a good practice
I usually use IoC frameworks to inject dependencies that are services. Is it ok to mark classes that are data objects as IoC components? To be more clear I will give an example. I have an abstract ...
-2votes
1answer
685views
Why EJB service Injection requires the specific subclass to be created?
Most Java EE guidelines suggest that we should define Abstract EJB services (APIs) and then define concrete implementations in order to conform with OO design principles. But at the injection point, ...
4votes
2answers
141views
Simple examples of properly designed Asp.Net applications illustrating different service layers?
I've been programming professionally for years now at several different companies and I consider myself to be a fairly competent programmer. However, of everywhere I've worked there are usually dozens ...
18votes
2answers
2kviews
Is there evidence that the use of dependency injection improves outcomes in software engineering?
Notwithstanding its popularity, is there any empirical evidence that shows that Dependency Injection (and/or using a DI container) helps with, say, reducing bug counts, improving maintainability, or ...
1vote
1answer
2kviews
Service locator vs Dependency Injection?
I have a class which acts as a Adaptor between an HTTP request and our Application's custom domain request. So every Http request element: URI, headers, content are mapped to our customized domain ...
4votes
1answer
253views
Does an IoC Container affect the design of an application using Dependency Injection?
Is it safe to say that a Container is the "program" or mechanism that manages IoC via DI, but it doesn't really change your initial design of DI to accomplish loose coupling? In other words, if I ...
0votes
1answer
294views
How to use dependency injection for applications that are configurable at startup?
I'm writing software that needs to be fairly configurable in nature. At this point what that means is that it first reads in a users configuration file and then builds the objects it needs based on ...
0votes
1answer
392views
What is a good practical example demonstrating an architectural advantage in interface dependency injection
I need help (preferably by way of a practical example) to understand why/if the following implementation of IoC/DI (in this case using Ninject) provides an architectural advantage: using (IKernel ...
0votes
1answer
2kviews
IOC Between Presentation and Infrastructure Layer
Question: I would like to set forth dependency mapping from a *.config file from a project that has no reference to the project that contains the concrete class. Scenario: I'll be using terms from C#,...
7votes
5answers
23kviews
Dependency Injection Confusion
I think I have a decent grasp of what Dependency Inversion principle (DIP) is, my confusion is more around dependency injection. My understanding is the whole point of DI is to decouple parts of an ...